<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
      <el-form-item>
        <el-radio-group v-model="topRadio">
          <el-radio-button label="0">全部</el-radio-button>
          <el-radio-button label="3">自定义</el-radio-button>
        </el-radio-group>
      </el-form-item>
      <el-form-item style="margin-right: 40px">
        <el-date-picker
          v-model="value1"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :disabled="topRadio != 3"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="地域" style="margin-right: 40px">
        <el-cascader
          v-model="selectedOptions"
          :options="pcaTextArr"
          @change="handleChange"
           :props="{ checkStrictly: true }"
        ></el-cascader>
      </el-form-item>
      <el-form-item style="margin-right: 40px">
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
        <el-button size="mini" @click="resetQuery" type="primary"
          >导出</el-button
        >
      </el-form-item>
    </el-form>
    <el-table
      :data="tableData"
      style="width: 100%"
      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
      row-key="id"
      @sort-change="sortByColumn"
    >
      <el-table-column prop="date" label="地域" :align="tableAlign">
      </el-table-column>
      <el-table-column prop="name" label="已合作" :align="tableAlign">
      </el-table-column>
      <el-table-column prop="address" label="停止合作" :align="tableAlign">
      </el-table-column>
      <el-table-column
        prop="address"
        label="总数"
        :sortable="true"
        :align="tableAlign"
      >
      </el-table-column>
    </el-table>
    <pagination
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>
<script>
import { pcaTextArr } from "element-china-area-data";
export default {
  data() {
    return {
      tableAlign: "center",
      pcaTextArr,
      topRadio: "0",
      queryParams: {},
      tableData: [
        {
          id: 1,
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          id: 2,
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
        },
        {
          id: 3,
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
          children: [
            {
              id: 31,
              date: "2016-05-01",
              name: "王小虎",
              address: "上海市普陀区金沙江路 1519 弄",
            },
            {
              id: 32,
              date: "2016-05-01",
              name: "王小虎",
              address: "上海市普陀区金沙江路 1519 弄",
            },
          ],
        },
        {
          id: 4,
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
      ],
    };
  },
  methods: {
    sortByColumn(column) {
      console.log(column);
    },
  },
};
</script>
<style lang="scss" scoped>
.app-container {
}
</style>
